import  time

from selenium import webdriver
from selenium.webdriver.common.by import By


driver = webdriver.Chrome(executable_path='Chromedriver.exe')
# 2.输入访问地址（URL）
driver.get("http://121.43.169.97:8848/pageA.html")
#3页面操作
#通过name属性定位页面元素
#定位元素并输入内容
# driver.find_element(By.XPATH,"//*[@id='userA']").send_keys("admin")
driver.find_element(By.XPATH,"//input[@name='userA']").send_keys("admin")
# driver.find_element(By.XPATH,"//*[@id='passwordA']").send_keys("123456")
# driver.find_element(By.XPATH,"//input[@name='passwordA']").send_keys("123456")
# driver.find_element(By.XPATH,"//input[@id='passwordA']").send_keys("123456")
driver.find_element(By.XPATH,"//input[@placeholder='请输入密码']").send_keys("123456")
driver.find_element(By.XPATH,"//input[@name='emailA']").send_keys("123456@qq.com")
#属性和逻辑结合
driver.find_element(By.XPATH,"//*[@type='button' and @value='prompt']").click()
#层级和属性结合

# # 3.页面信息操作
# #暂停3秒
# time.sleep(3)
# # 4.关闭/退出浏览器
# #关闭驱动
# driver.quit()